package huawei;

import java.util.*;

/**
 * 矩形绘制
 */
public class Q153 {

    public static class Point {
        int x;
        int y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public boolean equals(Object object) {
            Point point = (Point) object;
            return this.x == point.x && this.y == point.y;
        }

        @Override
        public  int hashCode() {
            int h = 0;
            char val[] = (x + "_" + y).toCharArray();

            for (int i = 0; i < val.length; i++) {
                h = 31 * h + val[i];
            }
            return h;
        }
    }

    public static void main(String[] args) {
        int[] op1 = {0,2,2,0};
        int[] op2 = {-1,1,1,-1};

        Set<Point> set = new HashSet<>();
        for (int i = op1[0] + 1; i <= op1[1]; i++) {
            for (int j = op1[3] + 1; j <= op1[2]; j++) {
                set.add(new Point(i, j));
            }
        }

        for (int i = op2[0] + 1; i <= op2[1]; i++) {
            for (int j = op2[3] + 1; j <= op2[2]; j++) {
                set.add(new Point(i, j));
            }
        }

        System.out.println(set.size());
    }
}
